package myself.a001算法入门;

import myself.a000util.Constants;
import myself.a000util.Logarithm;

/**
 * @author 叶之越
 * Description
 * Date 2021/1/20
 * Time 20:33
 * Mail 739153436@qq.com
 */
public class BubbleSort {
    public static void main(String[] args) {
        Logarithm.check(BubbleSort.class, Constants.normalSort);
    }

    public void sort(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            for (int j = 1; j < arr.length - i; j++) {
                if (arr[j] < arr[j - 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j - 1];
                    arr[j - 1] = temp;
                }
            }
        }
    }
}
